﻿<%@ Page Language="C#" AutoEventWireup="true" CodeFile="QuanLySanPham.aspx.cs" Inherits="admin_QuanLySanPham" MasterPageFile="~/admin/MasterPage.master" %>

<%@ Register Assembly="CKEditor.NET" Namespace="CKEditor.NET" TagPrefix="CKEditor" %>

        <asp:Content ID="contentNoiDung" ContentPlaceHolderID="contentNoiDung" Runat="Server">

        <div id="main-content">
            <!-- Main Content Section with everything -->
            <!-- Page Head -->
            <div class="content-box">
                <div class="content-box-header">
                    <h3 style="cursor: s-resize;">
                        <%=GetLoaiSanPhamName() %></h3>
                    <ul class="content-box-tabs">
                        <li><a href="#tab1" class="default-tab current">Danh sách</a></li>
                        <!-- href must be unique and match the id of target div -->
                                            <asp:PlaceHolder runat="server" ID="pnTab2">

                        <li><a href="#tab2">Thêm mới</a></li>
                                            </asp:PlaceHolder>

                    </ul>
                    <div class="clear">
                    </div>
                </div>
                <!-- End .content-box-header -->
                <div class="content-box-content">
                    <div class="tab-content default-tab" id="tab1" style="display: block;">
                        <!-- This is the target div. id must match the href of this div's tab -->
                        Tìm theo tên: <asp:TextBox runat="server" ID="txtSearch" CssClass="text-input"></asp:TextBox>
                        <asp:Button ID="bttSearch" runat="server" OnClick="bttSearch_OnClick" CssClass="button" Text="Tìm" />
                        <table>
                            <thead>
                                <tr>
                                    <th>
                                        Tên sản phẩm
                                    </th>
                                    <th>
                                        Loại
                                    </th>
                                    <th>
                                        Ngày tạo
                                    </th>
                                    <th>
                                    </th>
                                </tr>
                            </thead>
                            <tfoot>
                                <tr>
                                    <td colspan="7">
                                        <p style="font-weight: bold; margin-left: 30px; color: #545454; font-size: 12px;
                                            text-align: right">
                                            Tổng cộng:
                                            <asp:Label ID="ResultCount" runat="server"></asp:Label>
                                            sản phẩm
                                        </p>
                                        <center>
                                            <div style="font-size: 12px">
                                                <%if (TotalRecord > PagingSize)
                                                  {%>
                                                <!-- Paging { -->
                                                <ul class="paginator">
                                                    <%= PageString%>
                                                </ul>
                                                <!-- } Paging -->
                                                <%} %>
                                            </div>
                                        </center>
                                        <%--										<div class="pagination">
											<a href="#" title="First Page">« First</a><a href="#" title="Previous Page">« Previous</a>
											<a href="#" class="number" title="1">1</a>
											<a href="#" class="number" title="2">2</a>
											<a href="#" class="number current" title="3">3</a>
											<a href="#" class="number" title="4">4</a>
											<a href="#" title="Next Page">Next >></a><a href="#" title="Last Page">Last »</a>
										</div> <!-- End .pagination -->
                                        --%>
                                        <div class="clear">
                                        </div>
                                    </td>
                                </tr>
                            </tfoot>
                            <tbody>
                                <asp:Repeater ID="repSanPham" runat="server" OnItemDataBound="repSanPham_OnItemDataBound" >
                                    <ItemTemplate>
                                        <tr class="alt-row">
                                            <td>
                                                <a href='<%#LinkHelper.LinkAdminSanPham(Eval("SanPhamID"))%>&loaicha=<%#Eval("LoaiSanPham")%>'>
                                                    <%#Eval("TenSanPham")%></a>
                                            </td>
                                            <td>
                                                <%#GetLoaiSanPham( Eval("LoaiSanPham"))%>
                                            </td>
                                            <td>
                                                <%#GetNgayTao(Eval("NgayDang"))%>
                                            </td>
                                            <td>
                                                <!-- Icons -->
                                                <a  href='<%#LinkHelper.LinkAdminSanPham(Eval("SanPhamID"))%>&loaicha=<%#Eval("LoaiSanPham")%>' title="Edit">
                                                    <img src="resources/images/icons/pencil.png" alt="Edit"></a> 
              <asp:Button ID="learnMoreButton" CssClass="button" runat="server" Text="Xóa" CommandArgument='<%#Eval("SanPhamID")%>' OnClick="learnMoreButton_Click" UseSubmitBehavior="False" BorderStyle="None" />
                                            </td>
                                        </tr>
                                    </ItemTemplate>
                                    <AlternatingItemTemplate>
                                        <tr>
                                            <td>
                                                <a href='<%#LinkHelper.LinkAdminSanPham(Eval("SanPhamID"))%>&loaicha=<%#Eval("LoaiSanPham")%>'>
                                                    <%#Eval("TenSanPham")%></a>
                                            </td>
                                            <td>
                                                <%#GetLoaiSanPham( Eval("LoaiSanPham"))%>
                                            </td>
                                            <td>
                                                <%#GetNgayTao(Eval("NgayDang"))%>
                                            </td>
                                            <td>
                                                <!-- Icons -->
                                                <a  href='<%#LinkHelper.LinkAdminSanPham(Eval("SanPhamID"))%>&loaicha=<%#Eval("LoaiSanPham")%>' title="Edit">
                                                    <img src="resources/images/icons/pencil.png" alt="Edit"></a> 
              <asp:Button ID="learnMoreButton" CssClass="button" runat="server" Text="Xóa" CommandArgument='<%#Eval("SanPhamID")%>' OnClick="learnMoreButton_Click" UseSubmitBehavior="False" BorderStyle="None" />
                                            </td>
                                        </tr>
                                    </AlternatingItemTemplate>
                                </asp:Repeater>
                            </tbody>
                        </table>
                    </div>
                    <!-- End #tab1 -->
                    <div class="tab-content" id="tab2" style="display: none;">
                        <form action="" method="post">
                        <fieldset>
                            <!-- Set class to "column-left" or "column-right" on fieldsets to divide the form into columns -->
                            <div class="formleft">
                                <p>
                                    <label>
                                        Tên sản phẩm</label>
                                    <asp:TextBox ID="txtTenSanPham" runat="server" CssClass="text-input large-input"></asp:TextBox>
                                </p>
                                <div class="formleft">
                                    <p>
                                        <label>
                                            Loại sản phẩm</label>
                                        <asp:DropDownList runat="server" ID="ddlLoaiCha">
                                        </asp:DropDownList>
                                    </p>
                                </div>
                                <div class="formleft">
                                    <p>
                                        <label>
                                            Sản phẩm mới?</label>
                                        <asp:CheckBox ID="ckSanPhamMoi" runat="server" />Có
                                    </p>
                                </div>
                                <div class="formright">
                                    <p>
                                        <label>
                                            Thứ tự</label>
                                        <asp:TextBox ID="txtThuTu" runat="server" CssClass="text-input large-input"></asp:TextBox>
                                    </p>
                                </div>
                                <p>
                                    <label>
                                        Hình ảnh</label>
                                    <input type="file" id="inputFile" name="inputFile" runat="server" />
                                    <asp:TextBox ID="txtHinhAnh" runat="server" Width="450px" Visible="false">
                                    </asp:TextBox>
                                </p>
                            </div>
                            <div class="formright">
                                <p>
                                    <label>
                                        Hãng sản xuất</label>
                                    <asp:TextBox ID="txtHangSanXuat" runat="server" CssClass="text-input large-input"></asp:TextBox>
                                </p>
                                <p>
                                    <label>
                                        Chủng loại</label>
                                    <asp:TextBox ID="txtChungLoai" runat="server" CssClass="text-input large-input"></asp:TextBox>
                                </p>
                                <hr>
                                <p>
                                    <label>
                                        Giá</label>
                                    <asp:TextBox ID="txtGia" runat="server" CssClass="text-input large-input"></asp:TextBox>
                                </p>
                            </div>
                            <div class="clear">
                            </div>
                            <script src="<%=LinkHelper.GetLinkJs("kTabs.js")%>" type="text/javascript"></script>
                            <p>
                                <div class="shadetabs">
                                    <ul>
                                        <li id="tabs1" onclick="show_next1('tabs1')" class="selected"><a href="javascript:void(0)">
                                            Tổng quan</a></li>
                                        <li id="tabs2" onclick="show_next1('tabs2')"><a href="javascript:void(0)">Thông số kỹ
                                            thuật</a></li>
                                        <li id="tabs3" onclick="show_next1('tabs3')"><a href="javascript:void(0)">Hình ảnh</a></li>
                                    </ul>
                                </div>
                            </p>
                            <p>
                                <div id="tabs1_data">
                                    <CKEditor:CKEditorControl ID="txtTongQuan" runat="server" Height="300px" Width="700px">
                                    </CKEditor:CKEditorControl>
                                </div>
                                <div id="tabs2_data" style="display: none;">
                                    <CKEditor:CKEditorControl ID="txtThongSo" runat="server" Height="300px" Width="700px">
                                    </CKEditor:CKEditorControl>
                                </div>
                                <div id="tabs3_data" style="display: none;">
                                    <CKEditor:CKEditorControl ID="txtAlbum" runat="server" Height="300px" Width="700px">
                                    </CKEditor:CKEditorControl>
                                </div>
                            </p>
                            <div class="clear">
                            </div>
                            <p>
                                <asp:RequiredFieldValidator runat="server" ControlToValidate="txtTenSanPham" Display="Dynamic" ValidationGroup="vdSanPham" ErrorMessage="Vui lòng nhập tên sản phẩm!"></asp:RequiredFieldValidator>
                                <asp:CompareValidator Operator="DataTypeCheck" Type="Integer" runat="server" ControlToValidate="txtGia" ErrorMessage="Giá chỉ nhập số!" Display="Dynamic" ValidationGroup="vdSanPham" ></asp:CompareValidator>
                                <asp:CompareValidator Operator="DataTypeCheck" Type="Integer" runat="server" ControlToValidate="txtThuTu" ErrorMessage="Thứ tự chỉ nhập số!" Display="Dynamic" ValidationGroup="vdSanPham" ></asp:CompareValidator>
                            </p>
                            <p>
                                <asp:Button runat="server" ID="btnOK" CssClass="button" ValidationGroup="vdSanPham" Text="Hoàn tất" OnClick="btnOK_OnClick" />
                            </p>
                        </fieldset>
                        <div class="clear">
                        </div>
                        <!-- End .clear -->
                        </form>
                    </div>
                    <!-- End #tab2 -->
                </div>
                <!-- End .content-box-content -->
            </div>
            <!-- End .content-box -->
            <div id="footer">
                <small></small>
            </div>
            <!-- End #footer -->
        </div>
        </asp:Content>
